<template>
  <view class="bottom-bar">
    <view class="bar-item bar-left">
      <view>
        <i class="icon service"></i>
        <text class="text">客服</text>
      </view>
      <view>
        <i class="icon shop"></i>
        <text class="text">店铺</text>
      </view>
      <view>
        <i class="icon select"></i>
        <text class="text">收藏</text>
      </view>
    </view>
    <view class="bar-item bar-right">
      <view class="cart" @click="addToCart">加入购物车</view>
      <view class="buy">购买</view>
    </view>
  </view>
</template>

<script>
export default {
  name: "DetailBottomBar",
  methods: {
    addToCart(){
      // alert('加入购物车成功！')
      this.$emit('addToCart')
    }
  }
}
</script>

<style lang="scss">
  .bottom-bar{
    position: fixed;
		left: 0;
		right: 0;
		bottom: 0px;
    z-index: 999;
    height: 49px;
    background-color: #fff;
    display: flex;
    text-align: center;
  }
  .bar-item {
    flex: 1;
    display: flex;
  }

  .bar-item>view {
    flex: 1;
  }

  .bar-left .text {
    font-size: 12px;
  }

  .bar-left .icon {
    display: block;
    width: 22px;
    height: 22px;
    margin: 5px auto 0px;
    background: url("../../../static/detail/detail_bottom.png") 0 0/100%;
  }

  .bar-left .service {
    background-position:0 -54px;
  }

  .bar-left .shop {
    background-position:0 -98px;
  }

  .bar-right {
    font-size: 15px;
    color: #fff;
    line-height: 49px;
  }

  .bar-right .cart {
    background-color: #ffe817;
    color: #333;
  }

  .bar-right .buy {
    background-color: #f69;
  }
</style>
